Skip to content

fix: system theme#2524

Open
RohitKushvaha01 wants to merge 2 commits into
Acode-Foundation:mainfrom
RohitKushvaha01:fix/system-theme-editor-update
Open

fix: system theme#2524
RohitKushvaha01 wants to merge 2 commits into
Acode-Foundation:mainfrom
RohitKushvaha01:fix/system-theme-editor-update

Conversation

@RohitKushvaha01

Copy link
Copy Markdown
Member

Closes #2521

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR switches system-theme synchronization to browser color-scheme events. The main changes are:

  • Replaces periodic theme polling with a MediaQueryList change listener.
  • Applies the preferred editor theme when the OS color scheme changes.

Confidence Score: 5/5

The changed flow looks mergeable after two small compatibility and notification fixes.

  • Older MediaQueryList implementations can fail when the watcher starts.
  • Automatic OS theme changes can display a misleading settings-saved toast.
  • Listener registration and removal otherwise use the same stable callback.

src/palettes/changeTheme/index.js and src/theme/preInstalled.js

Important Files Changed

Filename Overview
src/palettes/changeTheme/index.js Replaces polling with a MediaQueryList listener, but lacks the legacy listener fallback.
src/theme/preInstalled.js Synchronizes the editor theme with the OS theme, but enables save notifications for automatic updates.

Reviews (1): Last reviewed commit: "fix: system theme" | Re-trigger Greptile

function startSystemThemeWatcher() {
if (intervalId) return;
intervalId = setInterval(syncSystemTheme, updateTimeMs);
darkModeMediaQuery.addEventListener("change", syncSystemTheme);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Legacy Media Query Listener Crash

When a WebView supports matchMedia but exposes only addListener, selecting the system theme now throws because addEventListener is undefined. The previous polling path worked in this runtime, so system-theme synchronization needs matching addListener and removeListener fallbacks.

Comment thread src/theme/preInstalled.js Outdated
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@RohitKushvaha01 RohitKushvaha01 added the CI: RUN ON-DEMAND PREVIEW RELEASES Triggers an on-demand preview build for this pull request via CI workflow. label Jul 23, 2026
@github-actions github-actions Bot removed the CI: RUN ON-DEMAND PREVIEW RELEASES Triggers an on-demand preview build for this pull request via CI workflow. label Jul 23, 2026
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown

🔴 (Workflow Trigger stopped), Your On-Demand Preview Release/build for #2524.
status: failure


Please Click here to view that github actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

System theme doesnt work

1 participant